package com.tiandao.mofang.core.jianying;

import com.tiandao.mofang.core.RobotSingleton;
import com.tiandao.mofang.core.role.ShengDao;
import com.tiandao.mofang.core.util.YiDong;

import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;

/**
 * 剑影十 (自动)
 */
public class TenCeng implements Runnable{
    private static Robot robot = RobotSingleton.getInstance();
    //燕南飞X坐标
    private static String YAN_NAN_FEI_X = "719";
    //燕南飞Y坐标
    private static String YAN_NAN_FEI_Y = "298";



    public static void main(String[] args) {
//        robot.mouseMove(1710,1030);
//        robot.mouseMove(1710,830);
//        robot.mouseMove(730,235);
//        robot.mouseMove(1177,290);
        robot.mouseMove(1100,750);
    }
    @Override
    public void run() {
        start();
    }

    public static void start(){
        while (true){
            //开启剑影十
            open();
            //第一位面
            one();
            //第二位面
            two();
            //第三位面
            thr();
            //退出位面
            tui();
        }
    }

    /**
     * 开启战境的方法
     */
    public static void open(){
        try {
            //移动到综合上等待1.5秒点击
            Thread.sleep(5000);
            robot.mouseMove(1710,1030);
            Thread.sleep(1500);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
            //等待两秒移动到战境上
            Thread.sleep(2000);
            robot.mouseMove(1710,800);
            Thread.sleep(1500);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
            //等待两秒移动到剑影上
            Thread.sleep(2000);
            robot.mouseMove(730,235);
            Thread.sleep(1500);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
            //等待两秒移动到拾上
            Thread.sleep(2000);
            robot.mouseMove(1177,290);
            Thread.sleep(1500);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
            //等待两秒移动到开始上
            Thread.sleep(2000);
            robot.mouseMove(1100,750);
            Thread.sleep(1500);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
            Thread.sleep(15000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    /**
     * 第一位面
     */
    public static void one(){
        //找燕南飞开启第一位面
        try {
            //上马
            Thread.sleep(2000);
            robot.keyPress(KeyEvent.VK_6);
            robot.keyRelease(KeyEvent.VK_6);
            //移动到燕南飞
            YiDong.zouLu(YAN_NAN_FEI_X,YAN_NAN_FEI_Y);
            //对话开启第一位面
            Thread.sleep(33000);
            robot.keyPress(KeyEvent.VK_F);
            robot.keyRelease(KeyEvent.VK_F);
            Thread.sleep(1100);
            robot.mouseMove(270,550);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
            Thread.sleep(150);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
            Thread.sleep(150);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
            //开启躲技能监听线程
            DuoJiNengThread d = new DuoJiNengThread();
            Thread t = new Thread(d);
            t.setDaemon(true);
            t.start();
            //开启BOSSshow监听线程

            //开启打怪线程
            ShengDao shengDao = new ShengDao();
            Thread t1 = new Thread(shengDao);
            t1.setDaemon(true);
            t1.start();

        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    /**
     * 第二位面
     */
    public static void two(){

    }

    /**
     * 第三位面
     */
    public static void thr(){

    }

    /**
     * 退出位面
     */
    public static void tui(){

    }


}
